package com.saudidentalapp;

import android.app.Activity;
import android.os.Parcelable;
import android.support.v4.view.PagerAdapter;
import android.support.v4.view.ViewPager;
import android.view.LayoutInflater;
import android.view.View;

public class MyPageLayoutAdapter extends PagerAdapter 
{
	protected transient Activity mContext;		
	LayoutInflater layoutInflater;
	
	private int[] mData = 
	{
	    R.layout.activity_dashboard,
	    R.layout.activity_programs,
	    R.layout.activity_search
	};
	public MyPageLayoutAdapter(Activity context) 
	{
		this.mContext=context;
		layoutInflater=LayoutInflater.from(context);
	}
	@Override
	public Object instantiateItem(View container, int position)
	{
		View v=layoutInflater.inflate(mData[position], null);
		((ViewPager) container).addView(v, 0);
		return v;
	}
	
	@Override
	public void destroyItem(View container, int position, Object object) 
	{
		((ViewPager) container).removeView((View) object);
	}
		
	@Override
	public int getCount() 
	{
		return mData.length;
	}
	

	@Override
	public boolean isViewFromObject(View view, Object object) 
	{		
		return view == ((View) object);
	}
	
	@Override
	public void finishUpdate(View container) {}
	
	@Override
	public void restoreState(Parcelable state, ClassLoader loader) {}
	
	@Override
	public Parcelable saveState() {
		return null;
	}
	
	@Override
	public void startUpdate(View container) {}

}
